<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Reactor Overview</title>
  </head>
  <body>

    <h1>Reactor Overview</h1>

    <p>
    This HOWTO introduces the Twisted reactor, describes the basics of the
    reactor and links to 
    </p>
  
    <h2>Reactor Basics</h2>

    <p> The reactor is the core of the event loop within Twisted -- the loop
    which drives applications using Twisted. The reactor
    provides basic interfaces to a number of services, including
    network communications, threading, and event dispatching.
    </p>

    <p>
    For information about using the reactor and the Twisted event loop, see:
    </p>

    <ul>
    <li>the event dispatching howtos: <a href="time.xhtml">Scheduling</a> and <a
    href="defer.xhtml">Using Deferreds</a>;</li>
    <li>the communication howtos: <a href="servers.xhtml">TCP
    servers</a>, <a href="clients.xhtml">TCP clients</a>, <a
    href="udp.xhtml">UDP networking</a> and <a href="process.xhtml">Using
    processes</a>; and</li>
    <li><a href="threading.xhtml">Using threads</a>.</li>
    </ul>

    <p> There are multiple implementations of the reactor, each
    modified to provide better support for specialized features
    over the default implementation.  More information about these
    and how to use a particular implementation is available via
    <a href="choosing-reactor.xhtml">Choosing a Reactor</a>. </p>

    
    <p>
    Twisted applications can use the interfaces in <code
    class="API">twisted.application.service</code> to configure and run the
    application instead of using
    boilerplate reactor code. See <a
    href="application.xhtml">Using Application</a> for an introduction to
    Application.
    </p>

    <h2>Using the reactor object</h2>

    <p> You can get to the <code class="API"
    base="twisted.internet">reactor</code> object using the following code:</p>

<pre class="python">
from twisted.internet import reactor
</pre>

    <p> The reactor usually implements a set of interfaces, but 
       depending on the chosen reactor and the platform, some of
       the interfaces may not be implemented: </p>

    <ul>
      <li><code class="API" base="twisted.internet.interfaces"
        >IReactorCore</code>: Core (required) functionality.</li>
      <li><code class="API" base="twisted.internet.interfaces"
        >IReactorFDSet</code>: Use FileDescriptor objects.</li>
      <li><code class="API" base="twisted.internet.interfaces"
        >IReactorProcess</code>: Process management. Read the 
        <a href="process.xhtml">Using Processes</a> document for
        more information.</li>
      <li><code class="API" base="twisted.internet.interfaces"
        >IReactorSSL</code>: SSL networking support.</li>
      <li><code class="API" base="twisted.internet.interfaces"
        >IReactorTCP</code>: TCP networking support. More information
        can be found in the <a href="servers.xhtml">Writing Servers</a>
        and <a href="clients.xhtml">Writing Clients</a> documents.</li>
      <li><code class="API" base="twisted.internet.interfaces"
        >IReactorThreads</code>: Threading use and management. More
        information can be found within <a href="threading.xhtml"
        >Threading In Twisted</a>.</li>
      <li><code class="API" base="twisted.internet.interfaces"
        >IReactorTime</code>: Scheduling interface.  More information
        can be found within <a href="time.xhtml">Scheduling Tasks</a>.</li>
      <li><code class="API" base="twisted.internet.interfaces"
        >IReactorUDP</code>: UDP networking support. More information
        can be found within <a href="udp.xhtml">UDP Networking</a>.</li>
      <li><code class="API" base="twisted.internet.interfaces"
        >IReactorUNIX</code>: UNIX socket support.</li>
    </ul>
  </body>
</html>
